﻿using System;
using System.ComponentModel;
using System.Runtime.InteropServices;

namespace Teigha.Core
{
	public class OdGiPlotGenerator : OdGiConveyorNode
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public OdGiPlotGenerator(IntPtr cPtr, bool cMemoryOwn) : base(GlobalsPINVOKE.OdGiPlotGenerator_SWIGUpcast(cPtr), cMemoryOwn)
		{
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(OdGiPlotGenerator obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~OdGiPlotGenerator()
		{
			this.Dispose();
		}

		public override void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							GlobalsPINVOKE.delete_OdGiPlotGenerator(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
			base.Dispose();
		}

		public new static OdGiPlotGenerator cast(OdRxObject pObj)
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = GlobalsPINVOKE.OdGiPlotGenerator_cast(OdRxObject.getCPtr(pObj));
			OdGiPlotGenerator result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdGiPlotGenerator)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdGiPlotGenerator)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdGiPlotGenerator)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new static OdRxClass desc()
		{
			OdRxClass result = (OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(GlobalsPINVOKE.OdGiPlotGenerator_desc(), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdRxClass isA()
		{
			OdRxClass result = (OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(GlobalsPINVOKE.OdGiPlotGenerator_isA(this.swigCPtr), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdRxObject queryX(OdRxClass protocolClass)
		{
			OdRxObject result = Teigha.Core.Helpers.odrxCreateObjectInternal(GlobalsPINVOKE.OdGiPlotGenerator_queryX(this.swigCPtr, OdRxClass.getCPtr(protocolClass)), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new static OdGiPlotGenerator createObject()
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = GlobalsPINVOKE.OdGiPlotGenerator_createObject();
			OdGiPlotGenerator result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdGiPlotGenerator)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdGiPlotGenerator)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdGiPlotGenerator)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual void setDeviation(OdGeDoubleArray deviations)
		{
			GlobalsPINVOKE.OdGiPlotGenerator_setDeviation__SWIG_0(this.swigCPtr, OdGeDoubleArray.getCPtr(deviations));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void setDeviation(OdGiDeviation pDeviation)
		{
			GlobalsPINVOKE.OdGiPlotGenerator_setDeviation__SWIG_1(this.swigCPtr, pDeviation.GetCPtr());
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void setDrawContext(OdGiConveyorContext pDrawContext)
		{
			GlobalsPINVOKE.OdGiPlotGenerator_setDrawContext(this.swigCPtr, pDrawContext.GetCPtr());
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void enable(bool bEnable)
		{
			GlobalsPINVOKE.OdGiPlotGenerator_enable(this.swigCPtr, bEnable);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual bool enabled()
		{
			bool result = GlobalsPINVOKE.OdGiPlotGenerator_enabled(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual void dot_per_inch(double dpi)
		{
			GlobalsPINVOKE.OdGiPlotGenerator_dot_per_inch__SWIG_0(this.swigCPtr, dpi);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual double dot_per_inch()
		{
			double result = GlobalsPINVOKE.OdGiPlotGenerator_dot_per_inch__SWIG_1(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void dot_per_mm(double dpmm)
		{
			GlobalsPINVOKE.OdGiPlotGenerator_dot_per_mm__SWIG_0(this.swigCPtr, dpmm);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public double dot_per_mm()
		{
			double result = GlobalsPINVOKE.OdGiPlotGenerator_dot_per_mm__SWIG_1(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual void setPlotStyle(OdPsPlotStyleData psd)
		{
			GlobalsPINVOKE.OdGiPlotGenerator_setPlotStyle(this.swigCPtr, OdPsPlotStyleData.getCPtr(psd));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void setExternalPolylineOut(OdGiPlotGenerator.PolylineOut pPolylineOut)
		{
			GlobalsPINVOKE.OdGiPlotGenerator_setExternalPolylineOut(this.swigCPtr, OdGiPlotGenerator.PolylineOut.getCPtr(pPolylineOut));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual OdGiPlotGenerator.PolylineOut externalPolylineOut()
		{
			IntPtr intPtr = GlobalsPINVOKE.OdGiPlotGenerator_externalPolylineOut(this.swigCPtr);
			OdGiPlotGenerator.PolylineOut result = (intPtr == IntPtr.Zero) ? null : new OdGiPlotGenerator.PolylineOut(intPtr, false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual void setExternalEllipseOut(OdGiPlotGenerator.EllipseOut pEllipseOut)
		{
			GlobalsPINVOKE.OdGiPlotGenerator_setExternalEllipseOut(this.swigCPtr, OdGiPlotGenerator.EllipseOut.getCPtr(pEllipseOut));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual OdGiPlotGenerator.EllipseOut externalEllipseOut()
		{
			IntPtr intPtr = GlobalsPINVOKE.OdGiPlotGenerator_externalEllipseOut(this.swigCPtr);
			OdGiPlotGenerator.EllipseOut result = (intPtr == IntPtr.Zero) ? null : new OdGiPlotGenerator.EllipseOut(intPtr, false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		private object locker = new object();

		private HandleRef swigCPtr;

		public class PolylineOut : IDisposable
		{
			[EditorBrowsable(EditorBrowsableState.Never)]
			public PolylineOut(IntPtr cPtr, bool cMemoryOwn)
			{
				this.swigCMemOwn = cMemoryOwn;
				this.swigCPtr = new HandleRef(this, cPtr);
			}

			[EditorBrowsable(EditorBrowsableState.Never)]
			public static HandleRef getCPtr(OdGiPlotGenerator.PolylineOut obj)
			{
				if (obj != null)
				{
					return obj.swigCPtr;
				}
				return new HandleRef(null, IntPtr.Zero);
			}

			~PolylineOut()
			{
				this.Dispose();
			}

			public virtual void Dispose()
			{
				if (this.swigCPtr.Handle != IntPtr.Zero)
				{
					if (this.swigCMemOwn)
					{
						lock (this.locker)
						{
							if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
							{
								this.swigCMemOwn = false;
								GlobalsPINVOKE.delete_OdGiPlotGenerator_PolylineOut(this.swigCPtr);
							}
						}
						this.swigCMemOwn = false;
					}
					this.swigCPtr = new HandleRef(null, IntPtr.Zero);
				}
				GC.SuppressFinalize(this);
			}

			public virtual bool plotGeneratorPolylineOut(OdGePoint3d[] pPoints, LineEndStyle capStyle, LineJoinStyle joinStyle, double fLwd)
			{
				IntPtr intPtr = Teigha.Core.Helpers.MarshalPoint3dArray(pPoints);
				bool result;
				try
				{
					bool flag = GlobalsPINVOKE.OdGiPlotGenerator_PolylineOut_plotGeneratorPolylineOut(this.swigCPtr, intPtr, (int)capStyle, (int)joinStyle, fLwd);
					if (GlobalsPINVOKE.SWIGPendingException.Pending)
					{
						throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
					}
					result = flag;
				}
				finally
				{
					Marshal.FreeCoTaskMem(intPtr);
				}
				return result;
			}

			private object locker = new object();

			private HandleRef swigCPtr;

			protected bool swigCMemOwn;
		}

		public class EllipseOut : IDisposable
		{
			[EditorBrowsable(EditorBrowsableState.Never)]
			public EllipseOut(IntPtr cPtr, bool cMemoryOwn)
			{
				this.swigCMemOwn = cMemoryOwn;
				this.swigCPtr = new HandleRef(this, cPtr);
			}

			[EditorBrowsable(EditorBrowsableState.Never)]
			public static HandleRef getCPtr(OdGiPlotGenerator.EllipseOut obj)
			{
				if (obj != null)
				{
					return obj.swigCPtr;
				}
				return new HandleRef(null, IntPtr.Zero);
			}

			~EllipseOut()
			{
				this.Dispose();
			}

			public virtual void Dispose()
			{
				if (this.swigCPtr.Handle != IntPtr.Zero)
				{
					if (this.swigCMemOwn)
					{
						lock (this.locker)
						{
							if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
							{
								this.swigCMemOwn = false;
								GlobalsPINVOKE.delete_OdGiPlotGenerator_EllipseOut(this.swigCPtr);
							}
						}
						this.swigCMemOwn = false;
					}
					this.swigCPtr = new HandleRef(null, IntPtr.Zero);
				}
				GC.SuppressFinalize(this);
			}

			public virtual bool plotGeneratorEllipseOut(OdGeEllipArc3d arc, double width)
			{
				bool result = GlobalsPINVOKE.OdGiPlotGenerator_EllipseOut_plotGeneratorEllipseOut(this.swigCPtr, OdGeEllipArc3d.getCPtr(arc), width);
				if (GlobalsPINVOKE.SWIGPendingException.Pending)
				{
					throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
				}
				return result;
			}

			private object locker = new object();

			private HandleRef swigCPtr;

			protected bool swigCMemOwn;
		}
	}
}
